package com.kstech.ks_gaz01.realTime

import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.chad.library.adapter4.BaseQuickAdapter
import com.kstech.ks_gaz01.databinding.LayoutDialogItemBinding

class DialogAdapter : BaseQuickAdapter<String, DialogAdapter.VH>() {
    // 自定义ViewHolder类
    class VH(
        parent: ViewGroup,
        val binding: LayoutDialogItemBinding = LayoutDialogItemBinding.inflate(
            LayoutInflater.from(parent.context), parent, false
        ),
    ) : RecyclerView.ViewHolder(binding.root)

    override fun onCreateViewHolder(context: Context, parent: ViewGroup, viewType: Int): VH {
        // 返回一个 ViewHolder
        return VH(parent)
    }

    override fun onBindViewHolder(
        holder: VH,
        position: Int,
        value: String?
    ) {
        holder.binding.dialogItem.text = value
    }
}